package formularioPrincipal;

import formularios.DevolucaoAluno;
import formularios.FormAlunoPrincipal;
import formularios.FormLivroPrincipal;
import formularios.LocacaoAluno;
import formularios.Relatorios;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;

public class JF_MenuPrincipal extends javax.swing.JFrame {

    public JF_MenuPrincipal() {
        initComponents();
        timer1.start();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        timer1 = new org.netbeans.examples.lib.timerbean.Timer();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jB_sair = new javax.swing.JButton();
        jB_Devolucao = new javax.swing.JButton();
        jB_locação = new javax.swing.JButton();
        jB_livro = new javax.swing.JButton();
        jB_aluno = new javax.swing.JButton();
        jB_relatorio = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jL_data = new javax.swing.JLabel();
        jL_hora = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();

        timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
            public void onTime(java.awt.event.ActionEvent evt) {
                timer1OnTime(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SGB (Sistema Gerenciador da Biblioteca)");
        setBackground(new java.awt.Color(255, 255, 255));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setForeground(java.awt.Color.white);

        jPanel1.setBackground(new java.awt.Color(204, 255, 204));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 0), 3, true), "Multimeios", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 24), new java.awt.Color(0, 102, 0))); // NOI18N

        jPanel2.setBackground(new java.awt.Color(204, 255, 204));

        jB_sair.setBackground(new java.awt.Color(204, 255, 204));
        jB_sair.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jB_sair.setForeground(new java.awt.Color(255, 0, 0));
        jB_sair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Png/Figura9.png"))); // NOI18N
        jB_sair.setText("Sair");
        jB_sair.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(255, 0, 0), java.awt.Color.lightGray), new javax.swing.border.LineBorder(new java.awt.Color(255, 0, 0), 1, true)));
        jB_sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_sairActionPerformed(evt);
            }
        });
        jB_sair.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jB_sairKeyPressed(evt);
            }
        });

        jB_Devolucao.setBackground(new java.awt.Color(204, 255, 204));
        jB_Devolucao.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jB_Devolucao.setForeground(new java.awt.Color(0, 102, 0));
        jB_Devolucao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Png/Figura5.png"))); // NOI18N
        jB_Devolucao.setText("Devolução");
        jB_Devolucao.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(51, 102, 0), java.awt.Color.lightGray), new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 0), 1, true)));
        jB_Devolucao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_DevolucaoActionPerformed(evt);
            }
        });
        jB_Devolucao.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jB_DevolucaoKeyPressed(evt);
            }
        });

        jB_locação.setBackground(new java.awt.Color(204, 255, 204));
        jB_locação.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jB_locação.setForeground(new java.awt.Color(0, 102, 0));
        jB_locação.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Png/Figura12.png"))); // NOI18N
        jB_locação.setText("Locação");
        jB_locação.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(51, 102, 0), java.awt.Color.lightGray), new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 0), 1, true)));
        jB_locação.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_locaçãoActionPerformed(evt);
            }
        });
        jB_locação.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jB_locaçãoKeyPressed(evt);
            }
        });

        jB_livro.setBackground(new java.awt.Color(204, 255, 204));
        jB_livro.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jB_livro.setForeground(new java.awt.Color(0, 102, 0));
        jB_livro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Png/Figura11.png"))); // NOI18N
        jB_livro.setText("Livro");
        jB_livro.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(51, 102, 0), java.awt.Color.lightGray), new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 0), 1, true)));
        jB_livro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_livroActionPerformed(evt);
            }
        });
        jB_livro.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jB_livroKeyPressed(evt);
            }
        });

        jB_aluno.setBackground(new java.awt.Color(204, 255, 204));
        jB_aluno.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jB_aluno.setForeground(new java.awt.Color(0, 102, 0));
        jB_aluno.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Png/Figura10.PNG"))); // NOI18N
        jB_aluno.setText("Aluno");
        jB_aluno.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(51, 102, 0), java.awt.Color.lightGray), new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 0), 1, true)));
        jB_aluno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_alunoActionPerformed(evt);
            }
        });
        jB_aluno.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jB_alunoKeyPressed(evt);
            }
        });

        jB_relatorio.setBackground(new java.awt.Color(204, 255, 204));
        jB_relatorio.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jB_relatorio.setForeground(new java.awt.Color(0, 102, 0));
        jB_relatorio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Png/Figura2.png"))); // NOI18N
        jB_relatorio.setText("Relatorios");
        jB_relatorio.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(51, 102, 0), java.awt.Color.lightGray), new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 0), 1, true)));
        jB_relatorio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_relatorioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jB_aluno)
                    .addComponent(jB_sair)
                    .addComponent(jB_relatorio)
                    .addComponent(jB_Devolucao, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jB_locação)
                    .addComponent(jB_livro))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jB_Devolucao, jB_aluno, jB_livro, jB_locação, jB_relatorio, jB_sair});

        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jB_aluno, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(jB_livro)
                .addGap(18, 18, 18)
                .addComponent(jB_locação)
                .addGap(18, 18, 18)
                .addComponent(jB_Devolucao)
                .addGap(18, 18, 18)
                .addComponent(jB_relatorio, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jB_sair)
                .addContainerGap())
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jB_Devolucao, jB_aluno, jB_livro, jB_locação, jB_relatorio, jB_sair});

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/biblioteca/livros.png"))); // NOI18N

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/formularioPrincipal/mundo-na-palma-da-mão11 cópia.png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(141, 141, 141)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(36, Short.MAX_VALUE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(80, 80, 80)
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap()))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel3))
                    .addComponent(jLabel1))
                .addGap(113, 113, 113)
                .addComponent(jLabel2)
                .addContainerGap())
        );

        jPanel4.setBackground(new java.awt.Color(204, 255, 204));
        jPanel4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 0), 3, true));

        jL_data.setBackground(new java.awt.Color(255, 255, 255));
        jL_data.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jL_data.setForeground(new java.awt.Color(0, 102, 0));
        jL_data.setText("Data:");

        jL_hora.setBackground(new java.awt.Color(255, 255, 255));
        jL_hora.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jL_hora.setForeground(new java.awt.Color(0, 102, 0));
        jL_hora.setText("Hora:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(0, 102, 0));
        jLabel4.setText("Biblioteca v1.0");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jL_data, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jL_hora, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jL_hora, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jL_data, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 489, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-546)/2, (screenSize.height-579)/2, 546, 579);
    }// </editor-fold>//GEN-END:initComponents

    private void jB_alunoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_alunoActionPerformed
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    new FormAlunoPrincipal().setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(JF_MenuPrincipal.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        // TODO add your handling code here:
    }//GEN-LAST:event_jB_alunoActionPerformed

    private void jB_livroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_livroActionPerformed
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    new FormLivroPrincipal().setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(JF_MenuPrincipal.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        // TODO add your handling code here:
    }//GEN-LAST:event_jB_livroActionPerformed

    private void jB_locaçãoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_locaçãoActionPerformed

        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    new LocacaoAluno().setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(JF_MenuPrincipal.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }//GEN-LAST:event_jB_locaçãoActionPerformed

    private void jB_DevolucaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_DevolucaoActionPerformed
     java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new DevolucaoAluno().setVisible(true);
             }
        });
        
        
    }//GEN-LAST:event_jB_DevolucaoActionPerformed

    private void jB_sairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_sairActionPerformed
System.exit(0);
    }//GEN-LAST:event_jB_sairActionPerformed

    private void jB_alunoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jB_alunoKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jB_alunoKeyPressed

    private void jB_livroKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jB_livroKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jB_livroKeyPressed

    private void jB_locaçãoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jB_locaçãoKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jB_locaçãoKeyPressed

    private void jB_DevolucaoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jB_DevolucaoKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jB_DevolucaoKeyPressed

    private void jB_sairKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jB_sairKeyPressed
    }//GEN-LAST:event_jB_sairKeyPressed

    private void jB_relatorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_relatorioActionPerformed
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Relatorios().setVisible(true);
            }
        });
    }//GEN-LAST:event_jB_relatorioActionPerformed

    private void timer1OnTime(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timer1OnTime
        java.util.Date data_hora = new java.util.Date();
        SimpleDateFormat formataData = new SimpleDateFormat("dd/MM/yyyy");
        SimpleDateFormat formataHora = new SimpleDateFormat("hh:mm:ss");
        jL_data.setText(formataData.format(data_hora));
        jL_hora.setText(formataHora.format(data_hora));
        
    }//GEN-LAST:event_timer1OnTime
 public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new JF_MenuPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jB_Devolucao;
    private javax.swing.JButton jB_aluno;
    private javax.swing.JButton jB_livro;
    private javax.swing.JButton jB_locação;
    private javax.swing.JButton jB_relatorio;
    private javax.swing.JButton jB_sair;
    private javax.swing.JLabel jL_data;
    private javax.swing.JLabel jL_hora;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    // End of variables declaration//GEN-END:variables
}
